<?php
use common\WuMing;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use frontend\models\CommentForm;

?>
<style>
    body {
        padding:  10px;
    }
</style>
<div class="main pd20 mb20" style="position:relative;">
    <div class="row gbook_box" style="border:none; background:none;">

        <div class="col-sm-11">


            <div class="media">
                <div class="media-left">
                    <a href="javascript:;">
                        <img class="media-object img-rounded" src="<?= Yii::$app->urlManager->baseUrl.'/'.$model['img'] ?>" width="50px" height="50px">
                    </a>
                </div>
                <div class="media-body">
                    <h4>
                        <a href="<?= Yii::$app->urlManager->createUrl(['post/view', 'id' => $model['id']]) ?>" class=""
                           title="<?= $model['title'] ?>"><?= $model['title'] ?></a>
                    </h4>

                    <div class="gbook_list">
                        <a href="javascript:;" target="_blank" title="<?= $model['nickname'] ?>"
                           class="nickname"><?= $model['nickname'] ?></a>&nbsp;&nbsp;<?= $model['signature'] ?>&nbsp;&nbsp;发表于<?= date("Y-m-d H:i:s", $model['create_at']) ?>
                    </div>

                    <p class="text-justify"><?= $model['content'] ?></p>

                    <div class="small text-right">
                        <span class="glyphicon glyphicon-eye-open"></span> <?= $model['view'] ?>次浏览&nbsp;&nbsp;
                        <span class="glyphicon glyphicon-comment"></span> <?=WuMing::getComments($model['id'])?>次讨论&nbsp;&nbsp;
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 富文本编辑器 -->
<!--    <textarea class="form-control" rows="5"></textarea>-->

<!--    <a href="javascript:;" name="comment"></a>-->
<!--    --><?php //$form =  ActiveForm::begin(['id'=>'comment-form'])?>
<!--    <script id="container2" name="CommentForm[content]"></script>-->
<!--    --><?//= $form->field(new CommentForm(),'post_id')->hiddenInput(['value'=>$model['id']])->label(false)?>
<!--    <div class="form-group">-->
<!--        <div class="row">-->
<!--            <div class="col-xs-2 col-xs-offset-10">-->
<!--                --><?//=Html::Button("提交",['class'=>'btn btn-success btn-block','id'=>'comment-btn'])?>
<!--            </div>-->
<!---->
<!--        </div>-->
<!--    </div>-->
<!--    --><?php //ActiveForm::end()?>
    <!-- 富文本编辑器结束 -->

</div>

<?php if(!empty($comment)) :?>

    <div class="main">
        <!-- Nav tabs -->
        <div role="tabpanel" style="position:relative;">

            <ul class="nav nav-tabs" role="tablist">
                <li role="presentation" <?php if(!in_array($type,[1,2,3])) :?>class="active" <?php endif?> ><a href="<?=Yii::$app->urlManager->createUrl(['post/dialog','id'=>$model['id']])?>">热&nbsp;门</a>
                </li>
                <li role="presentation"  <?php if($type == 1) :?>class="active" <?php endif?> ><a href="<?=Yii::$app->urlManager->createUrl(['post/dialog','type'=>'1','id'=>$model['id']])?>">最&nbsp;新</a>
                </li>
                <li role="presentation" <?php if($type == 2) :?>class="active" <?php endif?> ><a href="<?=Yii::$app->urlManager->createUrl(['post/dialog','type'=>'2','id'=>$model['id']])?>">最&nbsp;旧</a>
                </li>
                <li role="presentation" <?php if($type == 3) :?>class="active" <?php endif?> ><a href="<?=Yii::$app->urlManager->createUrl(['post/dialog','type'=>'3','id'=>$model['id']])?>">具有争议</a></li>
            </ul>


            <!-- Tab panes -->
            <div class="tab-content">
                <div role="tabpanel" class="tab-pane active" id="one01">
                    <div id="comment-content">
                        <div class="main">
                            <?php WuMing::traverseArray($comment,$uid)?>
                        </div>

                    </div>
                </div>


            </div>

        </div>
        <!-- Nav tabs -->
    </div>


<?php endif?>


<?php
$script = <<<UM
jQuery(document).ready(function($) {
    var ue = UE.getEditor('container', {
        initialFrameHeight:150
    });
});

UM;
//$this->registerJs($script);
?>

